// component/banner/banner.js
var util = require('../../utils/util.js');
Component({
  properties: {
    urlsData: {
      type: Array,
      value: [],
    },
  },
  methods: {
    /**
     * 页面跳转
     */
    pageSkip: function (e) {
      var index = e.currentTarget.dataset.index;
      var bannerObj = this.data.urlsData[index];
      if (bannerObj.jump_type == 0) {  //内部链接
        wx.navigateTo({
          url: '../../' + bannerObj.link,
        })
      } else if (bannerObj.jump_type == 1) {  //外部H5链接
        var link = util.encode(bannerObj.link);
        var title = announcementObj.title;
        wx.navigateTo({
          url: '../../pages/others/web-view/web-view?link=' + link + '&title=' + title,
        })
      } else if (bannerObj.jump_type == 2) {   //跳转到其他小程序
        wx.navigateToMiniProgram({
          appId: bannerObj.app_id,
          path: bannerObj.link,
          envVersion: 'trial',
          success(res) {
            // 打开成功
            console.log(res)
          }
        });
      }
    }
  }
})